package com.springboot.demo.event;

import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Component
public class AnnoRegisterListener {
    @Async
    @EventListener(UserRegisterEvent.class)
    public void register(UserRegisterEvent event){
        System.out.println("监听事件触发");
        System.out.println(event.getUser().getUsername());
    }
}
